package com.example.lib_mvp.base.mvp;

public class DataModel {
//    public static HashMap<String, Class> TokenMap = new HashMap<>();

    public static BaseModel request(Class clazz) {
        // 声明一个空的BaseModel
        BaseModel model = null;
        // 判断class对象是不是BaseModel的实例
        try {
            //利用反射机制获得对应Model对象的引用
            model = (BaseModel) clazz.newInstance();
        } catch (InstantiationException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        }
        return model;
    }

//    public static void setToken(BaseModel baseModel) {
//        if (!TokenMap.containsKey(baseModel.getClass().getSimpleName())) {
//            TokenMap.put(baseModel.getClass().getSimpleName(), baseModel.getClass());
//        }
//    }
}
